Sleep Content Analysis (or Any-Other-Construct Content Analysis)¶

This notebook fosters the reproducibility of the following paper:

  • Gauld C, Martin VP, Richaud A, Bailleul S, Lucie V, Perromat JL, Zreik I, Taillard J, Geoffroy PA, Lopez R, Micoulaud-Franchi JA. Systematic Item Content and Overlap Analysis of Self-reported Multiple Sleep Disorders Screening Questionnaires in Adults. Journal of Clinical Medicine. https://doi.org/10.3390/jcm12030852

If you want to compute the same metrics with you own data, we redirect you towards our generic content analysis GitHub https://github.com/vincentpmartin/generic_content_analysis

⚠️ PLEASE READ BEFORE DOING ANYTHING ⚠️¶

Welcome to this online coding environment ! You are currently running a Jupyter notebook that we hope to be usefull for content analysis of questionnaires.

Each cell can be ran individually (pressing the "Play" ▶ button or pressing CTRL+ENTER in the each cell). In order to make everything run smoothly, it is strongly recommended to run them in order.

RECOMMANDED: You can also run all the cells at the same time : "Run" → "Run All Cells".

At the end of the execution, you will have the opportunity to save all yours results in an HTML file, executing "File" → "Save and Export Notebook as" → "HTML"

If you have chosen to run every cell individually, please begin by running the following cell that imports all the required package for our code to work correctly ↓


1. Analysis of the number and frequency of symptoms¶

In a first step, we analyse the frequency of the symptoms.

Histogram of number of symptoms¶

Sorted by number of occurences¶

The figure has been save in the online folder (📁 symbol on the left) under the name figure1_histogram_1.pdf.
You can change the name and the format of the file changing the name in the fig.write_image() function.
⚠️ If you need it, save the figure on your local computer : these online file will be deleted as soon as you quit this page!

Sorted by category¶

The figure has been save in the online folder (📁 symbol on the left) under the name figure2_histogram_2.pdf.
You can change the name and the format of the file changing the name in the fig.write_image() function.
⚠️ If you need it, save the figure on your local computer : these online file will be deleted as soon as you quit this page!

Number of symptoms by questionnaire¶

Specific symptoms Compound symptoms Total
ICSD 47 0 47
DSM 34 0 34
SDQ 32 8 40
Sleep50 31 3 34
ASQ 23 9 32
SDS-CL-25 20 8 28
HSDQ 15 12 27
PSQI 13 12 25
ISDI 16 8 24
GSAQ 4 18 22
SDS-CL-17 13 8 21
SSC 17 2 19
BNSQ 11 6 17
OSQ 12 5 17

The table has been save in the online folder (📁 symbol on the left) under the name table1_symptoms_per_questionnaire.xlsx.
You can change the name and the format of the file changing the name in the sympt_per_questionnaire.to_excel() function.
⚠️ If you need it, save the excel file on your local computer : these online file will be deleted as soon as you quit this page!

Symptoms that are in classifications but not in questionnaires¶

--- ICSD ---
Sleep resistance
Cyanosis
Altered perception
Unvoluntary voiding
Malaise
Circadian period > 24h
--- DSM ---
Sleep resistance
Circadian period > 24h

Number of symptoms in each category for each questionnaire¶

ICSD DSM SDQ Sleep50 ASQ SDS-CL-25 HSDQ PSQI ISDI GSAQ SDS-CL-17 SSC BNSQ OSQ
SLEEPINESS SYMPTOMS 4 4 4 2 2 2 4 2 4 2 2 2 4 2
INSOMNIA SYMPTOMS 5 5 3 3 3 3 3 3 4 3 3 4 3 4
RESPIRATORY SYMPTOMS 4 3 3 3 3 3 2 3 1 2 3 2 3 2
PSYCHIATRIC SYMPTOMS 5 1 4 3 3 1 2 1 2 1 0 1 0 0
BEHAVIORAL SYMPTOMS DURING SLEEP 9 8 4 5 4 5 4 3 2 4 5 0 0 1
MOTOR SYMPTOMS 7 3 6 4 3 5 2 2 3 4 3 3 0 1
GENERAL SYMPTOMS 6 3 4 3 3 2 2 0 2 1 2 2 0 1
SLEEP PERIOD SYMPTOMS 7 7 3 4 3 4 3 4 1 1 2 0 3 1
NON OTHERWISE SPECIFIED 0 0 9 7 8 3 5 7 5 4 1 5 4 5

The table has been save in the online folder (📁 symbol on the left) under the name table2_categorie_per_questionnaire.xlsx.
You can change the name and the format of the file changing the name in the cat_per_questionnaire.T.to_excel() function.
⚠️ If you need it, save the excel file on your local computer : these online file will be deleted as soon as you quit this page!

Distribution across the categories of the symptoms measured by each questionnaire¶

(i.e. same thing as before, but normalized by questionnaire (sum across lines equals 1)).

Figure 3 has been save in the online folder (📁 symbol on the left) under the name figure3_heatmap.pdf. You can change the name and the format of the file changing the name in the fig.write_image() function.
⚠️ If you need it, save the figure on your local computer : these online file will be deleted as soon as you quit this page!


2. Analysis and data vizualisation of content analysis Figure¶

Content Analysis Figure¶

If you want to analyse custom data, you will have to set the variable max_radius so that the figure have the desired look !

The figure has been save in the online folder (📁 symbol on the left) under the name figure4_radial.pdf. You can change the name and the format of the file changing the name in the fig.write_image() function.
⚠️ If you need it, save the figure on your local computer : these online file will be deleted as soon as you quit this page!

Overlap between questionnaires - Jaccard Index¶

In order to estimate the overlap between the symptoms measured by the questionnes, calculate the Jaccard index, which is defined as the number of symmtoms that are measured by both questionnaires, divided by the number of unique symptoms measured both questionnaires.

Jaccard index of symptom for each pair of questionnaire¶

First, we compute the Jaccard index for each pair of questionnaires and plot it using a heatmap.

ICSD DSM SDQ Sleep50 ASQ SDS-CL-25 HSDQ PSQI ISDI GSAQ SDS-CL-17 SSC BNSQ OSQ
ICSD 1.000000 0.723404 0.553571 0.500000 0.436364 0.500000 0.423077 0.333333 0.365385 0.352941 0.416667 0.269231 0.254902 0.230769
DSM 0.723404 1.000000 0.480000 0.511111 0.434783 0.550000 0.525000 0.404762 0.414634 0.365854 0.571429 0.292683 0.342105 0.307692
SDQ 0.553571 0.480000 1.000000 0.644444 0.636364 0.478261 0.522727 0.382979 0.488372 0.377778 0.355556 0.372093 0.325581 0.357143
Sleep50 0.500000 0.511111 0.644444 1.000000 0.571429 0.631579 0.605263 0.404762 0.487179 0.400000 0.486486 0.394737 0.378378 0.378378
ASQ 0.436364 0.434783 0.636364 0.571429 1.000000 0.463415 0.512821 0.425000 0.473684 0.421053 0.358974 0.416667 0.361111 0.441176
SDS-CL-25 0.500000 0.550000 0.478261 0.631579 0.463415 1.000000 0.527778 0.394737 0.368421 0.388889 0.750000 0.382353 0.406250 0.363636
HSDQ 0.423077 0.525000 0.522727 0.605263 0.512821 0.527778 1.000000 0.368421 0.645161 0.484848 0.454545 0.437500 0.375000 0.466667
PSQI 0.333333 0.404762 0.382979 0.404762 0.425000 0.394737 0.368421 1.000000 0.400000 0.424242 0.393939 0.419355 0.500000 0.448276
ISDI 0.365385 0.414634 0.488372 0.487179 0.473684 0.368421 0.645161 0.400000 1.000000 0.483871 0.363636 0.535714 0.322581 0.518519
GSAQ 0.352941 0.365854 0.377778 0.400000 0.421053 0.388889 0.484848 0.424242 0.483871 1.000000 0.387097 0.464286 0.300000 0.392857
SDS-CL-17 0.416667 0.571429 0.355556 0.486486 0.358974 0.750000 0.454545 0.393939 0.363636 0.387097 1.000000 0.379310 0.407407 0.357143
SSC 0.269231 0.292683 0.372093 0.394737 0.416667 0.382353 0.437500 0.419355 0.535714 0.464286 0.379310 1.000000 0.333333 0.440000
BNSQ 0.254902 0.342105 0.325581 0.378378 0.361111 0.406250 0.375000 0.500000 0.322581 0.300000 0.407407 0.333333 1.000000 0.416667
OSQ 0.230769 0.307692 0.357143 0.378378 0.441176 0.363636 0.466667 0.448276 0.518519 0.392857 0.357143 0.440000 0.416667 1.000000

Table 3 has been save in the online folder (📁 symbol on the left) under the name table3_jaccard_pairs.xlsx.
You can change the name and the format of the file changing the name in the jaccard_table.to_excel() function.
⚠️ If you need it, save the excel file on your local computer : these online file will be deleted as soon as you quit this page!

The figure has been save in the online folder (📁 symbol on the left) under the name figure5_heatmap_jaccard.pdf.
You can change the name and the format of the file changing the name in the fig.write_image() function.
⚠️ If you want it, save the figure on your local computer : these online file will be deleted as soon as you quit this page!

Avg. Jaccard index¶

Then, we compute the average of Jaccard index for each questionnaire with other questionnaires (excluding the references).

Avg. Jaccard Index
SDQ 0.449209
Sleep50 0.489331
ASQ 0.461972
SDS-CL-25 0.468665
HSDQ 0.490976
PSQI 0.414701
ISDI 0.462467
GSAQ 0.411356
SDS-CL-17 0.426736
SSC 0.415941
BNSQ 0.375119
OSQ 0.416406
Average Jaccard index (wo references): 0.44024 (sd: 0.0356)

Table 4 has been save in the online folder (📁 symbol on the left) under the name table4_jaccard_average_questionnaires.xlsx.
You can change the name and the format of the file changing the name in the jaccard.to_excel() function.
⚠️ If you need it, save the excel file on your local computer : these online file will be deleted as soon as you quit this page!

Correlation between the number of symptoms and the average Jacquart index for each questionnaire¶

Avg. Jaccard Index Specific symptoms Compound symptoms Total
SDQ 0.449209 32 8 40
Sleep50 0.489331 31 3 34
ASQ 0.461972 23 9 32
SDS-CL-25 0.468665 20 8 28
HSDQ 0.490976 15 12 27
PSQI 0.414701 13 12 25
ISDI 0.462467 16 8 24
GSAQ 0.411356 4 18 22
SDS-CL-17 0.426736 13 8 21
SSC 0.415941 17 2 19
BNSQ 0.375119 11 6 17
OSQ 0.416406 12 5 17
Correlation between Jaccard Index and number of specific symptoms:  SpearmanrResult(correlation=0.6619975125797373, pvalue=0.019019455833880407)
Correlation between Jaccard Index and number of compound symptoms:  SpearmanrResult(correlation=-0.0035657479116033464, pvalue=0.9912250660088198)
Correlation between Jaccard Index and total number of symptoms:  SpearmanrResult(correlation=0.6584948802380455, pvalue=0.019892133524913664)

Jaccard index of symptoms for each pair of questionnaire for each category¶

Computing the same metric (average of average) for each category of questionnaires.

Avg. Jaccard Index
SLEEPINESS SYMPTOMS 0.606061
INSOMNIA SYMPTOMS 0.791667
RESPIRATORY SYMPTOMS 0.757576
PSYCHIATRIC SYMPTOMS 0.444444
BEHAVIORAL SYMPTOMS DURING SLEEP 0.438413
MOTOR SYMPTOMS 0.460216
GENERAL SYMPTOMS 0.398148
SLEEP PERIOD SYMPTOMS 0.353030
NON OTHERWISE SPECIFIED 0.372424

Table 5 has been save in the online folder (📁 symbol on the left) under the name table5_jaccard_categories.xlsx.
You can change the name and the format of the file changing the name in the res.to_excel() function.
⚠️ If you need it, save the excel file on your local computer : these online file will be deleted as soon as you quit this page!

Computing the same metric (average of average) for each subcategory.

Subcategory is empty

Sunburst Plot¶

The figure has been save in the online folder (📁 symbol on the left) under the name figure6_sunburst_plot.pdf.
You can change the name and the format of the file changing the name in the fig.write_image() function.
⚠️ If you want it, save the figure on your local computer : these online file will be deleted as soon as you quit this page!


Export to html¶

You have reached the end of this notebook. If you want to save the whole page, you can download it to html with dynamic figures:

  • "File" → "Save and Export Notebook as" → "HTML"